package com.feihong.txgw.fragmentadapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.feihong.txgw.ui.fragment.nearby.FuJinMenDianFragment;
import com.feihong.txgw.ui.fragment.base.BaseFragment;

import java.util.ArrayList;

import static com.feihong.txgw.http.HttpTools.MENDIAN_ALL_URL;
import static com.feihong.txgw.http.HttpTools.MENDIAN_FUJIN_URL;

/**
 * Created by PVer on 2017/7/3.
 * 附近的门面多需要的pageradapter
 */

public class FujinMenDianPagerAdapter  extends FragmentPagerAdapter {


    private static  final String []TITLES ={"附近门店","全部门店"};
    private ArrayList<BaseFragment> fragments;
    public FujinMenDianPagerAdapter(FragmentManager fm) {
        super(fm);
        fragments =new ArrayList<>();

        FuJinMenDianFragment fujinMenDianFragment= FuJinMenDianFragment.newInstance(MENDIAN_FUJIN_URL);
        FuJinMenDianFragment allMenDianFragment= FuJinMenDianFragment.newInstance(MENDIAN_ALL_URL);

        fragments.add(fujinMenDianFragment);
        fragments.add(allMenDianFragment);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return TITLES[position];
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }


}
